package com.micro.ai.agents.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 会话实体类
 * 
 * @author micro-ai
 * @since 0.0.1
 */
@Data
@TableName("conversations")
@Schema(description = "会话信息")
public class Conversation implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @Schema(description = "会话ID", example = "conv_123456789")
    private String id;

    @Schema(description = "租户ID", example = "tenant_001")
    private String tenantId;

    @Schema(description = "智能体ID", example = "agent_123")
    private String agentId;

    @Schema(description = "用户ID", example = "user_001")
    private String userId;

    @Schema(description = "会话标题", example = "关于产品的咨询")
    private String title;

    @Schema(description = "状态", example = "active", allowableValues = {"active", "closed", "archived", "timeout"})
    private String status;

    @Schema(description = "开始时间")
    private LocalDateTime startedAt;

    @Schema(description = "结束时间")
    private LocalDateTime endedAt;

    @Schema(description = "消息数量", example = "10")
    private Integer messageCount;

    @Schema(description = "总token使用量", example = "5000")
    private Integer totalTokensUsed;

    @Schema(description = "最后消息时间")
    private LocalDateTime lastMessageAt;

    @Schema(description = "元数据（JSON）")
    private String metadata;

    @TableField(fill = FieldFill.INSERT)
    @Schema(description = "创建时间")
    private LocalDateTime createdAt;
}

